To move a mask


Mask can only be moved with the movieClip that contains it. We can not move the mask in the movieClip itself. Any instance in the mask layer is like a shape. The instance name and scripts all fail. Although we can still use frames tween.

The common effect we want is that we want the mask move relative to the masked movieClip. Generally, we know that we can move the movie with mask to left side and then move the masked movieClip right side back. This will return the masked movieClip back to the original position.

The problem is "how much" we need to move the movieClip right ward ?

The most robot and theoretical method is take advantage of localToGlobal and globalToLocal function, so that we know where is the "From" position and where is the "To" position. Just move from position 1 to position 2.

However, most movie involve very simple move. We need only simple math only.

The most tricky way is:

Make your masked movieClip and the mask focus to the zero point of the mask movieClip.

Then when mask goes to _x=35; just set the masked movieClip  _x=0-35; That will bring it back;

When the mask zoomed _xscale=300, just set the masked movieClip zoom _xscale= 100/300; That will bring back tha original size.

Question 1:
When the mask zoomed _xscale=200 and then _x=35, need I change the _x=0-35 to something according to the zoom factor ? Strangely, the answer is no.

Question 2:
When the mask did not zoomed but I zoom the masked movieClip to show magnifying effect. I move the masked movieClip to _x=35, need I change the _x=0-35 to something according to the zoom factor ? Yes, the answer is yes.

Strictly to say, both these condition does not bring back the original condition. The image is zoomed.

If we rotate the mask, then we need de-rotate the movieClip. This is simple when their registration point is at the same point.

How about we rotate and zoom the mask ? How to bring back the original movieClip shape ? Well, this is very difficult. Any de-rotation of the masked movieClip will result in SKEW. We need nested movieClip to do skew to undo the skew.

Anyway, here is some examples movie. You can see the codes. The codes are very short.

@